<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>setState</title>
    <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
    <script src="https://cdn.bootcss.com/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
    <div id="root"></div>
    <script type="text/babel">
    //1. React.Component写法
    class HelloWord extends React.Component{
        state={message:'你好呀！'}
        render(){
            return <h1>{this.state.message}</h1>
        }
    }


    //2. 无状态函数写法(箭头函数)
    // const HelloWord=(props)=>{
    //     return <h1>你好啊！{props.name}</h1>
    // }

    //2. 无状态函数写法(普通函数)
    // function HelloWord(props) {
    //     return <h1>你好啊！{props.name}</h1>
    // }

    ReactDOM.render(<HelloWord name="Jack"/>,document.getElementById('root'))
    </script>
</body>
</html>